﻿_autoRefreshPages = {};

function autoRefreshPage(ms) {
  var name = Forguncy.Page.getPageName();
  stopAutoRefreshPage(name);
  setInterval(function () {
    refreshPage(name);
  }, ms || 5000)
}

function refreshPage(name) {
  var page = Forguncy.Page, curName = page.getPageName();
  if (curName != name) {
    stopAutoRefreshPage(name);
    return;
  }
  page.suspendCalc();

  var tables = page.getListViews();
  $.each(tables, function () {
    this.reload();
  });

  page.resumeCalc();
}

function stopAutoRefreshPage(name) {
  var timer = _autoRefreshPages[name];
  if (timer != null) {
    clearInterval(timer);
  }
}

var FgcElement = FgcElement || {};

FgcElement.TableColumnSlots = FgcElement.TableColumnSlots || {};

FgcElement.TableColumnSlots.Content = FgcElement.TableColumnSlots.Content || {};

FgcElement.TableColumnSlots.Content["column-custom-render"] = function (scope) {
    //return `<div style="color: red;">{{ scope.row[scope.column.property] }}<div>`
}